<script>
import { computed, defineComponent } from 'vue'
import * as Antd from 'ant-design-vue'
/***
 *
 * createTime: "2022-04-20 08:14:46"
favoriteFileDto: null
fileMd5: ""
fileSize: 0
fileType: 0
fileUrl: ""
folderLevel: 1
id: 242
lastOperatorId: 42006
lastOperatorName: "郑强子"
local_loading: false
name: "我的备份"
operatorId: 42006
operatorName: "郑强子"
pid: 0
updateTime: "2022-04-20 08:14:56"
 */
export default defineComponent({
  props: {
    record: {
      type: Object,
      required: true,
    },
  },
  setup(props, context) {
    let record = computed(() => {
      return [
        {
          label: '文件名称',
          value: props.record.name,
        },
        {
          label: '创建时间',
          value: props.record.createTime,
        },

        {
          label: '最后更新时间',
          value: props.record.updateTime,
        },
        {
          label: '操作人',
          value: props.record.lastOperatorName,
        },
        {
          label: '容量',
          value:
            props.record.fileType == 0
              ? '-'
              : (props.record.fileSize / 1024).toFixed(2) + 'KB',
        },
        {
          label: 'md5',
          value: props.record.fileMd5 || '-',
        },
      ]
    })

    return { record }
  },
  render() {
    return (
      <Antd.List itemLayout="horizontal">
        {this.record.map((x) => {
          return (
            <Antd.ListItem>
              <Antd.ListItemMeta description={x.label}></Antd.ListItemMeta>
              {x.value}
            </Antd.ListItem>
          )
        })}
      </Antd.List>
    )
  },
})
</script>
